home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / pmake / tm.mk < prev    next >
Makefile  |  1991-11-06  |  10KB  |  318 lines

  1. #
  2. # This Makefile is included by several other system Makefiles.  It
  3. # sets up variables that depend on the particular target machine
  4. # being compiled for, such as compiler flags.  One variable should
  5. # be defined before including this file:
  6. #
  7. # TM        Target machine for which code is to be generated (e.g.
  8. #        sun2, sun3, spur, etc.)
  9. #
  10. # This file will create a variable TMCFLAGS, which, when passed to CC,
  11. # will ensure that an object file is generated for machines of type TM.
  12. # It will also generate a variable TMAFLAGS, which will serve the
  13. # same purpose for the assembler.  Finally, it will set program names
  14. # like AS and LD to values appropriate for the machine type.
  15. #
  16. # The only flags that should be defined here are those that are required 
  17. # for successful compilation on that machine.  Optional flags such as
  18. # optimization should be defined in local modules.  
  19. #
  20. # $Header: /sprite/lib/pmake/RCS/tm.mk,v 1.55 91/11/06 18:35:03 kupfer Exp $
  21.  
  22. # Down at the bottom we edit $MACHINES so that "make all" will behave
  23. # sensibly.  For the error messages below, though, we want to use the
  24. # real $MACHINES.  So, we define a new variable for use in the error
  25. # messages.
  26.  
  27. SUPPORTED_MACHINES    := $(MACHINES)
  28.  
  29. # What follows is a big long if/elif chain, keyed on TM, to set flags,
  30. # CC, etc.  Each top-level branch also verifies that TM is in MACHINES.
  31. # It would be nice if we could do this in just one place, but pmake
  32. # doesn't like the construct "empty(MACHINES:M$(TM))".
  33.  
  34. #if !empty(TM:Msun3)
  35. TMCFLAGS        = -msun3 -Dsun3 -Dsprite
  36. TMAFLAGS        = -m68020
  37. LDFLAGS            = -msun3
  38. #if empty(MACHINES:Msun3) && !make(newtm)
  39. .BEGIN::
  40.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  41.     @echo "supported machines ($(SUPPORTED_MACHINES))."
  42.     exit 1
  43. #endif
  44. #if !empty(MACHINE:Mds3100) || !empty(MACHINE:Mds5000)
  45. CC                      = gcc
  46. AS                      = gas
  47. LD                      = gld
  48. #endif
  49.  
  50. #elif !empty(TM:Mspur)
  51. TMCFLAGS        = -mspur -mlong-jumps -DLOCKREG 
  52. TMAFLAGS        =
  53. AS            = /sprite/cmds.$(MACHINE)/sas
  54. LD            = /sprite/cmds.$(MACHINE)/sld
  55. RANLIB            = /sprite/cmds.$(MACHINE)/sranlib
  56. XLD            = /sprite/cmds.$(MACHINE)/xld
  57. NOOPTIMIZATION        =
  58. LDFLAGS            = 
  59. #if empty(MACHINES:Mspur) && !make(newtm)
  60. .BEGIN::
  61.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  62.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  63.     exit 1
  64. #endif
  65.  
  66. #elif !empty(TM:Msun4)
  67. TMCFLAGS        = -msun4 -Dsprite -Dsun4
  68. TMAFLAGS        = -msparc
  69. LDFLAGS            = -msun4
  70. #if empty(MACHINES:Msun4) && !make(newtm)
  71. .BEGIN::
  72.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  73.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  74.     exit 1
  75. #endif
  76. #if !empty(MACHINE:Mds3100) || !empty(MACHINE:Mds5000)
  77. CC                      = gcc
  78. AS                      = gas
  79. LD                      = gld
  80. #endif
  81.  
  82. #elif !empty(TM:Mcleansun4)
  83. TMCFLAGS        = -msun4 -Dsprite -Dsun4 -DCLEAN -DCLEAN_LOCK
  84. TMAFLAGS        = -msparc
  85. LDFLAGS            = -msun4
  86. #if empty(MACHINES:Mcleansun4) && !make(newtm)
  87. .BEGIN::
  88.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  89.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  90.     exit 1
  91. #endif
  92. #if !empty(MACHINE:Mds3100) || !empty(MACHINE:Mds5000)
  93. CC                      = gcc
  94. AS                      = gas
  95. LD                      = gld
  96. #endif
  97.  
  98. #elif !empty(TM:Msun4c)
  99. TMCFLAGS        = -msun4 -Dsprite -Dsun4 -Dsun4c
  100. TMAFLAGS        = -msparc
  101. LDFLAGS            = -msun4
  102. #if empty(MACHINES:Msun4c) && !make(newtm)
  103. .BEGIN::
  104.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  105.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  106.     exit 1
  107. #endif
  108. #if !empty(MACHINE:Mds3100) || !empty(MACHINE:Mds5000)
  109. CC                      = gcc
  110. AS                      = gas
  111. LD                      = gld
  112. #endif
  113.  
  114. #elif !empty(TM:Mcleansun4c)
  115. TMCFLAGS        = -msun4 -Dsprite -Dsun4 -Dsun4c -DCLEAN -DCLEAN_LOCK
  116. TMAFLAGS        = -msparc
  117. LDFLAGS            = -msun4
  118. #if empty(MACHINES:Mcleansun4c) && !make(newtm)
  119. .BEGIN::
  120.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  121.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  122.     exit 1
  123. #endif
  124. #if !empty(MACHINE:Mds3100) || !empty(MACHINE:Mds5000)
  125. CC                      = gcc
  126. AS                      = gas
  127. LD                      = gld
  128. #endif 
  129.  
  130. #elif !empty(TM:Mcleansun3) 
  131. TMCFLAGS        = -msun3 -Dsun3 -Dsprite -DCLEAN -DCLEAN_LOCK
  132. TMAFLAGS        = -m68020
  133. LDFLAGS            = 
  134. #if empty(MACHINES:Mcleansun3) && !make(newtm)
  135. .BEGIN::
  136.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  137.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  138.     exit 1
  139. #endif
  140.  
  141. #elif !empty(TM:Mcleands3100)
  142. TMCFLAGS    = -Dds3100 -Dsprite -DCLEAN -DCLEAN_LOCK -Uultrix
  143. TMAFLAGS    = -Dds3100 -Dsprite -Uultrix
  144. LDFLAGS        = -L/sprite/lib/ds3100.md
  145. #if empty(MACHINES:Mcleands3100) && !make(newtm)
  146. .BEGIN::
  147.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  148.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  149.     exit 1
  150. #endif
  151.  
  152. #elif !empty(TM:Mds3100)
  153. TMCFLAGS    = -Dds3100 -Dsprite -Uultrix
  154. TMAFLAGS    = -Dds3100 -Dsprite -Uultrix
  155. LDFLAGS        = -L/sprite/lib/ds3100.md
  156. #if empty(MACHINES:Mds3100) && !make(newtm)
  157. .BEGIN::
  158.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  159.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  160.     exit 1
  161. #endif
  162. #if !empty(CC:Mgcc)
  163. TMCFLAGS    += -Dmips -DLANGUAGE_C
  164. #endif
  165. LINTFLAGS    += -Dmips -DLANGUAGE_C
  166.  
  167. #elif !empty(TM:Mds5000)
  168. TMCFLAGS    = -Dds5000 -Dsprite -Uultrix
  169. TMAFLAGS    = -Dds5000 -Dsprite -Uultrix
  170. LDFLAGS        = -L/sprite/lib/ds5000.md
  171. #if empty(MACHINES:Mds5000) && !make(newtm)
  172. .BEGIN::
  173.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  174.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  175.     exit 1
  176. #endif
  177. #if !empty(CC:Mgcc)
  178. TMCFLAGS    += -Dmips -DLANGUAGE_C
  179. #endif
  180. LINTFLAGS    += -Dmips -DLANGUAGE_C
  181.  
  182. #elif !empty(TM:Msun4nw)
  183.  
  184. #    Sun4 compiled not to use save/restore register window instructions.
  185. TMCFLAGS        = -msun4 -Dsprite -Dsun4 -B/users/mendel/lib/$(MACHINE).md/ -mno-windows -DNOWINDOWS
  186. TMAFLAGS        = -msparc
  187. LDFLAGS            = -msun4
  188. #if empty(MACHINES:Msun4nw) && !make(newtm)
  189. .BEGIN::
  190.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  191.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  192.     exit 1
  193. #endif
  194.  
  195. #elif !empty(TM:Msymm)
  196. TMCFLAGS    = -msymm -Dsprite -Dsymm
  197. TMAFLAGS    = -msymm
  198. LDFLAGS        = -msymm
  199. #if empty(MACHINES:Msymm) && !make(newtm)
  200. .BEGIN::
  201.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  202.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  203.     exit 1
  204. #endif
  205. #if !empty(MACHINE:Mds3100) || !empty(MACHINE:Mds5000)
  206. CC                      = gcc
  207. AS                      = gas
  208. LD                      = gld
  209. #endif
  210.  
  211. #elif !empty(TM:Msym)
  212. TMCFLAGS    = -msym -Dsprite -Dsym
  213. TMAFLAGS    = -msym
  214. LDFLAGS        = -msym
  215. #if empty(MACHINES:Msym) && !make(newtm)
  216. .BEGIN::
  217.     @echo "Sorry, the target machine ($(TM)) isn't in the list of"
  218.     @echo "allowed machines ($(SUPPORTED_MACHINES))."
  219.     exit 1
  220. #endif
  221. #if !empty(MACHINE:Mds3100) || !empty(MACHINE:Mds5000)
  222. CC                      = gcc
  223. AS                      = gas
  224. LD                      = gld
  225. #endif
  226.  
  227. #else
  228.  
  229. # (some random TM)
  230.  
  231. TMCFLAGS        ?= -m$(TM)
  232. TMAFLAGS        ?= -m$(TM)
  233. #endif
  234.  
  235. # (End of big if/elif chain)
  236.  
  237.  
  238.  
  239. # The line below makes "clean" machines types and people's private "machines"
  240. # invisible under for purposes of commands like "make all": you have
  241. # to ask for them explicitly with the TM= option.  Also make "spur"
  242. # and "symm" disappear; spur is obsolete, and symm is practically unused.
  243.  
  244. #ifdef MACHINES
  245. MACHINES    := $(MACHINES:Nfd:Njhh:Ncleansun4:Ncleansun4c:Ncleansun3:Ncleands3100:Ncleands5000:Nspur:Nsun4nw:Nsymm)
  246. #endif
  247.  
  248.  
  249.  
  250. # This next tangle of tests checks for bogus cross-compilations.  The
  251. # allowable cross-compilations are:
  252. #
  253. # on/target    sun3    sun4        DECstation    symm
  254. # sun3        ok    ok        unsupported    unsupported
  255. # sun4        ok    ok        unsupported    unsupported
  256. # DECstation    ok    ok w/o ld    ok        ok
  257. # symm        unsup.    unsup.        unsupported    ok
  258. #
  259. # For example, suns and DECstations can build for a sun3, but only
  260. # DECstations can build for DECstations.  
  261. # You can build for a sun4 on a DECstation, but only if you don't need
  262. # to use ld. -mdk 15-Sep-1991.
  263. #
  264. # Complications:
  265. # 1. We make "make all" intelligent enough not to try an unsupported
  266. #    cross-compilation.  This is done by hacking the list of allowed
  267. #    target types (MACHINES)).
  268. # 2. We try to recognize that gcc does know something about
  269. #    cross-compiling (see the CC assignments above).
  270. #
  271. # The tests are done in a separate batch because we only want to do
  272. # them if we're actually going to compile, assemble, or link
  273. # something.
  274.  
  275. # First check if we're actually going to build something.
  276.  
  277. #if !make(clean) && !make(depend) && !make(mkmf) && !make(tidy) && \
  278.     !make(installhdrs) && !make(mkmfall) && !make(cleanall) && \
  279.     !make(dependall) && !make(tidyall) && !make(dist) && !make(distall)
  280.  
  281. # We are.  Check for compatibility according to the above table, using
  282. # an if/elif chain based on MACHINE.
  283.  
  284. #if !empty(MACHINE:Msun3) || !empty(MACHINE:Msun4)
  285.  
  286. # This next expression is all on one line because the Symmetry pmake
  287. # can't handle continued lines in the middle of a parenthesized
  288. # expression. -mdk 15-May-1991.
  289.  
  290. #if (!empty(TM:Mds3100) || !empty(TM:Mcleands3100) || !empty(TM:Mds5000) || !empty(TM:Mcleands5000)) && empty(CC:Mgcc)
  291. .BEGIN::
  292.     @echo "you cannot compile for a DECstation on this machine"
  293.     exit 1
  294. #endif
  295. #if !empty(TM:Msymm)
  296. .BEGIN::
  297.     @echo "you cannot compile for a Symmetry on this machine"
  298.     exit 1
  299. #endif
  300. #ifdef MACHINES
  301. MACHINES    := $(MACHINES:Nds3100:Nds5000)
  302. #endif
  303.  
  304. #elif !empty(MACHINE:Msymm)
  305.  
  306. #if empty(TM:Msymm)
  307. .BEGIN::
  308.     @echo "you can only compile for a Symmetry on this machine"
  309.     exit 1
  310. #endif
  311. MACHINES    = symm
  312.  
  313. #endif /* MACHINE chain */
  314. #endif /* !make(clean), !make(depend), ... */
  315.  
  316. LDFLAGS    ?=
  317.